home *** CD-ROM | disk | FTP | other *** search
/ Retro Gamer 13 / Retro Gamer 13.iso / Amiga Forever / WINDOWS / MenuBox / js / af-main.js < prev    next >
Encoding:
JavaScript  |  2004-04-02  |  28.6 KB  |  651 lines

  1. /* Amiga Forever MenuBox Launcher          */
  2. /* Copyright 2002-2004 Cloanto Corporation */
  3. /* Home Page: www.amigaforever.com         */
  4.  
  5. /* Amiga Forever version */
  6.  
  7. var af_version_internal    = "600"                /* Amiga Forever internal version */
  8. var af_version_display    = "6.0"                /* Amiga Forever display version */
  9.  
  10. /* Amiga Forever MenuBox launcher language (defined later) */
  11.  
  12. var afm_language_system;                    /* system language */
  13. var afm_language_display;                    /* language actually used */
  14.  
  15. /* MenuBox configuration override settings (for testing purposes) */
  16.  
  17. var afm_test_product    = "auto";            /* "auto" or product code (mbdemo|special|online|premium) to override software detection and force its feature not installed descriptions and URLs */
  18. var afm_test_language    = "auto";            /* "auto" or to two-letter language code to override automatic language detection */
  19. var afm_debug_messages    = 1;                /* 1 enables display of warning and error messages */
  20.  
  21. /* directories and files checked to determine configuration */
  22.  
  23. var condition_runfrommedium            = "..\\Setup\\Setup.exe";                                    /* determines whether product can be installed or not */
  24. var condition_onlinepluspack        = "..\\..\\Audio\\playlist.m3u";                            /* determines whether Online Plus Pack add-on is installed */
  25. var condition_games                    = "..\\..\\Emulation\\shared\\hdf\\games\\af-games-01.hdf";    /* determines whether games are installed */
  26. var condition_level_atleastspecial    = "..\\..\\Emulation\\shared\\rom\\amiga-os-130.rom";            /* if not even this is present we are running a MenuBox demo */
  27. var condition_level_atleastonline    = "..\\..\\Emulation\\shared\\rom\\amiga-os-310.rom";            /* if this is present we have at least an Online Edition (which includes both 1.3 and 3.1 ROMs) */
  28. var condition_level_premium            = "..\\..\\Emulation\\shared\\dir\\Work\\Software\\PPaint\\H\\2\\Register.pprx";    /* we are running a Premium (CD or DVD) version, either from medium or installed */
  29.  
  30. /* other global variables */
  31.  
  32. var max_tabs = 4;
  33. var max_items = 7;
  34.  
  35. var afm_tab_current            = 0;                /* current MenuBox tab (1-4, with 0 meaning no current selection) */
  36. var afm_tab_gfx_current     = 0;                /* current visually selected MenuBox tab (1-4, with 0 meaning no current selection)  */
  37. var afm_tab_pointer_current    = 0;                /* current MenuBox tab with hand mouse pointer (1-4, with 0 meaning no current selection)  */
  38. var afm_item_current        = 0;                /* current MenuBox item (1-7, with 0 meaning no current selection) */
  39.  
  40. var afm_tab_type_general    = 1;
  41. var afm_tab_type_gallery    = 2;
  42. var afm_tab_type_videos        = 3;
  43. var afm_tab_type_games        = 4;
  44.  
  45. var afm_preview_description_pending = 0;    /* 1 while a second preview-description text is pending (otherwise we could clear before the actual write) */
  46. var afm_window_title    = "Amiga Forever";    /* MenuBox browser container window title */
  47.  
  48. var afm_tabs_initialized    = 0;            /* 0, or 1-4 as initialization progresses */
  49. var afm_tab_changing_step    = 0;            /* 0, or 1-4 as rebuild progresses */
  50.  
  51. var items_a = new Array(max_tabs);            /* number of items in this tab */
  52. var title_a = new Array(max_tabs);            /* array of current item title texts */
  53. var image_a = new Array(max_tabs);            /* array of current item images */
  54. var condition_a = new Array(max_tabs);        /* array of current item conditions (to display description text or "nofeature" text) */
  55. var description_a = new Array(max_tabs);    /* array of current item description texts */
  56. var featurepresent_a = new Array(max_tabs);    /* array of current item feature condition check results */
  57. var action_type_a = new Array(max_tabs);    /* array of current item action types */
  58. var action_file_a = new Array(max_tabs);    /* array of current item action files or urls */
  59. var action_params_a = new Array(max_tabs);    /* array of current item action parameters */
  60. var action_dir_a = new Array(max_tabs);        /* array of current item action directories */
  61.  
  62. for (i=0; i < max_tabs; i++)
  63. {
  64.  items_a[i] = 0;
  65.  title_a[i] = new Array(max_items);
  66.  image_a[i] = new Array(max_items);
  67.  condition_a[i] = new Array(max_items);
  68.  description_a[i] = new Array(max_items);
  69.  featurepresent_a[i] = new Array(max_items);
  70.  action_type_a[i] = new Array(max_items);
  71.  action_file_a[i] = new Array(max_items);
  72.  action_params_a[i] = new Array(max_items);
  73.  action_dir_a[i] = new Array(max_items);
  74. }
  75.  
  76. /* let's check the product type */
  77. /* mbdemo : MenuBox launcher/demo only (no ROM, OS or emulation files) */
  78. /* special: Special Edition with limited (1.3 only) ROM/OS content */
  79. /* online : Online Edition, with 1.3 and 3.X ROMs and OS */
  80. /* premium: fullest version, non-downloadable, with run-from-installation-medium capability */
  81. /* this information is placed in the URL so that the appropriate upgrade information can be displayed by the web server */
  82.  
  83. var af_product = "mbdemo";
  84.  
  85. if (afm_test_product == "auto")
  86. {
  87.     if (menubox_exists(condition_level_premium)) af_product = "premium";
  88.     else if (menubox_exists(condition_level_atleastonline)) af_product = "online";
  89.     else if (menubox_exists(condition_level_atleastspecial)) af_product = "special";
  90. }
  91. else af_product = afm_test_product;
  92.  
  93. /* see if installed (i.e. one with run-from-medium vs. run-after-installation) */
  94. /* in theory only the Premium Edition should have the setup files on the run-from-medium set of files */
  95. /* this affects items like "install" vs. "check for updates" in the first tab */
  96.  
  97. var af_installed = 1;
  98. if (menubox_exists(condition_runfrommedium)) af_installed = 0;
  99.  
  100. /* check if the Plus Pack files are installed */
  101. /* in theory the videos on the Premium Edition medium are better than the MP3s on the Plus Pack, but if they are installed let's list them */
  102.  
  103. var af_onlinepluspack    = 0;
  104. if (menubox_exists(condition_onlinepluspack)) af_onlinepluspack = 1;
  105.  
  106. /* check if games are installed (they may be missing in some markets, due to local rating regulations) */
  107.  
  108. var af_games = 0;
  109. if (menubox_exists(condition_games)) af_games = 1;
  110.  
  111. /* set MenuBox window title */
  112.  
  113. afm_window_title = afm_window_title + " " + af_version_display;
  114. if (af_product == "mbdemo") afm_window_title = afm_window_title + " Demo";
  115. if (af_product == "special") afm_window_title = afm_window_title + " SE";
  116. if (af_product == "online")
  117. {
  118.     afm_window_title = afm_window_title + " Online Edition";
  119.     if (af_onlinepluspack) afm_window_title = afm_window_title + "& Plus Pack";
  120. }
  121. menubox_title(afm_window_title);
  122.  
  123. /* set language resources and set dynamic not available/update texts and URLs */
  124.  
  125. af_localize();
  126.  
  127. /* we only differentiate between general and games (which may be special due to local rating regulations), not for each tab */
  128.  
  129. var txt_nofeature_general = lcl_txt_nofeature_notinstalled;
  130. var url_nofeature_general = "http://www.amigaforever.com";
  131.  
  132. var txt_nofeature_games = lcl_txt_nofeature_games;
  133. var url_nofeature_games = "http://www.amigaforever.com/download/games/";
  134.  
  135. /* set currently displayed texts */
  136.  
  137. var txt_nofeature_current_general = lcl_txt_nofeature_inprogress;
  138. var url_nofeature_current_general = url_nofeature_general;
  139.  
  140. var txt_nofeature_current_games = txt_nofeature_current_general;
  141. var url_nofeature_current_games = url_nofeature_current_general;
  142.  
  143. if (af_product != "premium")
  144. {    /* various buy/upgrade options */
  145.     url_nofeature_general = url_nofeature_general + "/shop/";
  146.  
  147.     if (af_product == "mbdemo") txt_nofeature_general = lcl_txt_nofeature_buy;
  148.     else if (af_product == "special" || af_product == "online")
  149.         {
  150.         txt_nofeature_general = lcl_txt_nofeature_upgrade;
  151.         }
  152. }
  153.  
  154. url_nofeature_general = url_nofeature_general + "?ref=" + af_product + "&ver=" + af_version_internal + "&langsys=" + afm_language_system + "&langmb=" + afm_language_display;
  155.  
  156. if (af_product != "premium" || af_games)
  157. {    /* only Premium Edition with no games has special text/action */
  158.     txt_nofeature_games = txt_nofeature_general;
  159.     url_nofeature_games = url_nofeature_general;
  160. }
  161.  
  162. /* initialize data for all tabs */
  163. function af_initialize()
  164. {
  165.  var item_offset = 0;    /* used when items are conditionally inserted (e.g. Plus Pack files) */
  166.  
  167.  /* tab 1 */
  168.  if (af_product == "special") item_offset = 1;    /* let's swap 1.3 and 3.X, so the available version comes first */
  169.  
  170.  title_a[0][item_offset+0]            = lcl_txt_t1_amigaos3x_title;
  171.  image_a[0][item_offset+0]            = "screen-afwb-3x.gif";
  172.  condition_a[0][item_offset+0]        = "..\\..\\Emulation\\shared\\rom\\amiga-os-310.rom";
  173.  description_a[0][item_offset+0]     = lcl_txt_t1_amigaos3x_descr;
  174.  action_type_a[0][item_offset+0]    = "execute";
  175.  action_file_a[0][item_offset+0]    = "WinUAE.exe";
  176.  
  177.  if (af_version_internal < "600") /* legacy version of Amiga Forever */
  178.      action_params_a[0][item_offset+0] = "-config=Configurations\\31+.uae";
  179.  else
  180.      action_params_a[0][item_offset+0] = "-config=Configurations\\af_3x.uae";
  181.  
  182.   action_dir_a[0][item_offset+0]        = "..\\..\\Emulation\\WinUAE";
  183.  
  184.  if (af_product == "special") item_offset = -1;
  185.  
  186.  title_a[0][item_offset+1]            = lcl_txt_t1_amigaos13_title;
  187.  image_a[0][item_offset+1]            = "screen-afwb-13.gif";
  188.  condition_a[0][item_offset+1]        = "..\\..\\Emulation\\shared\\rom\\amiga-os-130.rom";
  189.  description_a[0][item_offset+1]     = lcl_txt_t1_amigaos13_descr;
  190.  action_type_a[0][item_offset+1]    = "execute";
  191.  action_file_a[0][item_offset+1]    = "WinUAE.exe";
  192.  
  193.  if (af_version_internal < "600") /* legacy version of Amiga Forever */
  194.      action_params_a[0][item_offset+1] = "-config=Configurations\\13+.uae";
  195.  else
  196.      action_params_a[0][item_offset+1] = "-config=Configurations\\a500+2mb_13.uae";
  197.  
  198.  action_dir_a[0][item_offset+1]        = "..\\..\\Emulation\\WinUAE";
  199.  
  200.  item_offset = 0;
  201.  
  202.  title_a[0][item_offset+2]            = lcl_txt_t1_winuaeconfig_title;
  203.  image_a[0][item_offset+2]            = "screen-winuae.gif";
  204.  condition_a[0][item_offset+2]        = "..\\..\\Emulation\\WinUAE\\WinUAE.exe";
  205.  description_a[0][item_offset+2]     = lcl_txt_t1_winuaeconfig_descr;
  206.  action_type_a[0][item_offset+2]    = "execute";
  207.  action_file_a[0][item_offset+2]    = "WinUAE.exe";
  208.  action_params_a[0][item_offset+2]    = "-s use_gui=yes";
  209.  action_dir_a[0][item_offset+2]        = "..\\..\\Emulation\\WinUAE";
  210.  
  211.  title_a[0][item_offset+3]            = lcl_txt_t1_winfellowconfig_title;
  212.  image_a[0][item_offset+3]            = "screen-winfellow.gif";
  213.  condition_a[0][item_offset+3]        = "..\\..\\Emulation\\WinFellow\\WinFellow.exe";
  214.  description_a[0][item_offset+3]     = lcl_txt_t1_winfellowconfig_descr;
  215.  action_type_a[0][item_offset+3]    = "execute";
  216.  action_file_a[0][item_offset+3]    = "WinFellow.exe";
  217.  action_params_a[0][item_offset+3]    = "";
  218.  action_dir_a[0][item_offset+3]        = "..\\..\\Emulation\\WinFellow";
  219.  
  220.  title_a[0][item_offset+4]            = lcl_txt_t1_documentation_title;
  221.  image_a[0][item_offset+4]            = "screen-webbrowser.gif";
  222.  description_a[0][item_offset+4]     = lcl_txt_t1_documentation_descr;
  223.  action_type_a[0][item_offset+4]    = "execute";
  224.  action_file_a[0][item_offset+4]    = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_documentation;
  225.  
  226.   if (af_version_internal < "600") /* legacy version of Amiga Forever */
  227.     action_file_a[0][item_offset+4]    = "..\\..\\Documentation\index.html";
  228.  else
  229.     action_file_a[0][item_offset+4]    = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_documentation;
  230.  
  231.  condition_a[0][item_offset+4] = action_file_a[0][item_offset+4];
  232.  
  233.  action_params_a[0][item_offset+4]    = "";
  234.  action_dir_a[0][item_offset+4]        = "";
  235.  
  236.  if (af_installed)
  237.  {
  238.      title_a[0][item_offset+5]            = lcl_txt_t1_browsedir_title;
  239.      image_a[0][item_offset+5]            = "screen-browse.gif";
  240.      condition_a[0][item_offset+5]        = "..\\..\\";
  241.      description_a[0][item_offset+5]     = lcl_txt_t1_browsedir_descr;
  242.      action_type_a[0][item_offset+5]    = "execute";
  243.      action_file_a[0][item_offset+5]    = "..\\..\\";
  244.      action_params_a[0][item_offset+5]    = "";
  245.      action_dir_a[0][item_offset+5]        = "";
  246.  
  247.      title_a[0][item_offset+6]            = lcl_txt_t1_updates_title;
  248.      image_a[0][item_offset+6]            = "screen-updates.gif";
  249.      condition_a[0][item_offset+6]        = "..\\Software Manager\\softmcmd.exe";
  250.      description_a[0][item_offset+6]     = lcl_txt_t1_updates_descr;
  251.      action_type_a[0][item_offset+6]    = "execute";
  252.      action_file_a[0][item_offset+6]    = "softmcmd.exe";
  253.      action_params_a[0][item_offset+6]    = "/cn";
  254.      action_dir_a[0][item_offset+6]        = "..\\Software Manager";
  255.  }
  256.  else
  257.  {
  258.      title_a[0][item_offset+5]            = lcl_txt_t1_browsemedium_title;
  259.      image_a[0][item_offset+5]            = "screen-browse.gif";
  260.      condition_a[0][item_offset+5]        = "..\\..\\";
  261.      description_a[0][item_offset+5]     = lcl_txt_t1_browsemedium_descr;
  262.      action_type_a[0][item_offset+5]    = "execute";
  263.      action_file_a[0][item_offset+5]    = "..\\..\\";
  264.      action_params_a[0][item_offset+5]    = "";
  265.      action_dir_a[0][item_offset+5]        = "";
  266.  
  267.      title_a[0][item_offset+6]            = lcl_txt_t1_install_title;
  268.      image_a[0][item_offset+6]            = "screen-browse.gif";
  269.      condition_a[0][item_offset+6]        = "..\\Setup\\Setup.exe";
  270.      description_a[0][item_offset+6]     = lcl_txt_t1_install_descr;
  271.      action_type_a[0][item_offset+6]    = "execute";
  272.      action_file_a[0][item_offset+6]    = "Setup.exe";
  273.      action_params_a[0][item_offset+6]    = "";
  274.      action_dir_a[0][item_offset+6]        = "..\\Setup";
  275.  }
  276.  
  277.  items_a[0] = item_offset+7;
  278.  
  279.  /* tab 2 */
  280.  item_offset = 0;
  281.  
  282.  if (af_onlinepluspack)
  283.  {
  284.      title_a[1][item_offset+0]            = lcl_txt_t2_pluspack_title;
  285.      image_a[1][item_offset+0]            = "screen-webbrowser.gif";
  286.      condition_a[1][item_offset+0]        = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_pluspack;
  287.      description_a[1][item_offset+0]     = lcl_txt_t2_pluspack_descr;
  288.      action_type_a[1][item_offset+0]    = "execute";
  289.      action_file_a[1][item_offset+0]    = "..\\..\\Emulation\\shared\\dir\\Work\\Documentation\\"+lcl_file_pluspack;
  290.      action_params_a[1][item_offset+0]    = "";
  291.      action_dir_a[1][item_offset+0]        = "";
  292.  
  293.      item_offset = 1;
  294.  }
  295.  
  296.  title_a[1][item_offset+0]            = lcl_txt_t2_byte_title;
  297.  image_a[1][item_offset+0]            = "1985-amiga-byte.gif";
  298.  condition_a[1][item_offset+0]        = "..\\..\\Gallery\\1985-amiga-byte.tif";
  299.  description_a[1][item_offset+0]     = lcl_txt_t2_byte_descr;
  300.  action_type_a[1][item_offset+0]    = "execute";
  301.  action_file_a[1][item_offset+0]    = "..\\..\\Gallery\\1985-amiga-byte.tif";
  302.  action_params_a[1][item_offset+0]    = "";
  303.  action_dir_a[1][item_offset+0]        = "";
  304.  
  305.  title_a[1][item_offset+1]            = lcl_txt_t2_a1000_title;
  306.  image_a[1][item_offset+1]            = "1985-a1000-cover.gif";
  307.  condition_a[1][item_offset+1]        = "..\\..\\Gallery\\1985-a1000-cover.png";
  308.  description_a[1][item_offset+1]     = lcl_txt_t2_a1000_descr;
  309.  action_type_a[1][item_offset+1]    = "execute";
  310.  action_file_a[1][item_offset+1]    = "..\\..\\Gallery\\1985-a1000-cover.png";
  311.  action_params_a[1][item_offset+1]    = "";
  312.  action_dir_a[1][item_offset+1]        = "";
  313.  
  314.  title_a[1][item_offset+2]            = lcl_txt_t2_patent_title;
  315.  image_a[1][item_offset+2]            = "1985-patent-4777621.gif";
  316.  condition_a[1][item_offset+2]        = "..\\..\\Gallery\\1985-patent-4777621.tif";
  317.  description_a[1][item_offset+2]     = lcl_txt_t2_patent_descr;
  318.  action_type_a[1][item_offset+2]    = "execute";
  319.  action_file_a[1][item_offset+2]    = "..\\..\\Gallery\\1985-patent-4777621.tif";
  320.  action_params_a[1][item_offset+2]    = "";
  321.  action_dir_a[1][item_offset+2]        = "";
  322.  
  323.  title_a[1][item_offset+3]            = lcl_txt_t2_home_title;
  324.  image_a[1][item_offset+3]            = "screen-webbrowser.gif";
  325.  condition_a[1][item_offset+3]        = "";
  326.  description_a[1][item_offset+3]     = lcl_txt_t2_home_descr;
  327.  action_type_a[1][item_offset+3]    = "url";
  328.  action_file_a[1][item_offset+3]    = "http://www.amigaforever.com/gallery/";
  329.  action_params_a[1][item_offset+3]    = "";
  330.  action_dir_a[1][item_offset+3]        = "";
  331.  
  332.  items_a[1] = item_offset+4;
  333.  
  334.  /* tab 3 */
  335.  item_offset = 0;
  336.  
  337.  title_a[2][item_offset+0]            = lcl_txt_t3_1985nylaunchamiga_title;
  338.  image_a[2][item_offset+0]            = "1985-nylaunch-amiga.gif";
  339.  condition_a[2][item_offset+0]        = "..\\..\\Video\\1985-nylaunch-amiga.wmv";
  340.  description_a[2][item_offset+0]     = lcl_txt_t3_1985nylaunchamiga_descr;
  341.  action_type_a[2][item_offset+0]    = "execute";
  342.  action_file_a[2][item_offset+0]    = "..\\..\\Video\\1985-nylaunch-amiga.wmv";
  343.  action_params_a[2][item_offset+0]    = "";
  344.  action_dir_a[2][item_offset+0]        = "";
  345.  
  346.  title_a[2][item_offset+1]            = lcl_txt_t3_1989jayminermetcom_title;
  347.  image_a[2][item_offset+1]            = "1989-jayminer-metcom.gif";
  348.  condition_a[2][item_offset+1]        = "..\\..\\Video\\1989-jayminer-metcom.wmv";
  349.  description_a[2][item_offset+1]     = lcl_txt_t3_1989jayminermetcom_descr;
  350.  action_type_a[2][item_offset+1]    = "execute";
  351.  action_file_a[2][item_offset+1]    = "..\\..\\Video\\1989-jayminer-metcom.wmv";
  352.  action_params_a[2][item_offset+1]    = "";
  353.  action_dir_a[2][item_offset+1]        = "";
  354.  
  355.  title_a[2][item_offset+2]            = lcl_txt_t3_1990jayminercloanto_title;
  356.  image_a[2][item_offset+2]            = "1990-jayminer-cloanto.gif";
  357.  condition_a[2][item_offset+2]        = "..\\..\\Video\\1990-jayminer-cloanto.wmv";
  358.  description_a[2][item_offset+2]     = lcl_txt_t3_1990jayminercloanto_descr;
  359.  action_type_a[2][item_offset+2]    = "execute";
  360.  action_file_a[2][item_offset+2]    = "..\\..\\Video\\1990-jayminer-cloanto.wmv";
  361.  action_params_a[2][item_offset+2]    = "";
  362.  action_dir_a[2][item_offset+2]        = "";
  363.  
  364.  title_a[2][item_offset+3]            = lcl_txt_t3_1994deathbeddavehaynie_title;
  365.  image_a[2][item_offset+3]            = "1994-deathbed-davehaynie.gif";
  366.  condition_a[2][item_offset+3]        = "..\\..\\Video\\1994-deathbed-davehaynie.wmv";
  367.  description_a[2][item_offset+3]     = lcl_txt_t3_1994deathbeddavehaynie_descr;
  368.  action_type_a[2][item_offset+3]    = "execute";
  369.  action_file_a[2][item_offset+3]    = "..\\..\\Video\\1994-deathbed-davehaynie.wmv";
  370.  action_params_a[2][item_offset+3]    = "";
  371.  action_dir_a[2][item_offset+3]        = "";
  372.  
  373.  title_a[2][item_offset+4]            = lcl_txt_t3_home_title;
  374.  image_a[2][item_offset+4]            = "screen-webbrowser.gif";
  375.  condition_a[2][item_offset+4]        = "";
  376.  description_a[2][item_offset+4]     = lcl_txt_t3_home_descr;
  377.  action_type_a[2][item_offset+4]    = "url";
  378.  action_file_a[2][item_offset+4]    = "http://www.amigaforever.com/videos/";
  379.  action_params_a[2][item_offset+4]    = "";
  380.  action_dir_a[2][item_offset+4]        = "";
  381.  
  382.  items_a[2] = item_offset+5;
  383.  
  384.  /* tab 4 */
  385.  item_offset = 0;
  386.  
  387.  title_a[3][item_offset+0]            = lcl_txt_t4_deluxegalaga_title;
  388.  image_a[3][item_offset+0]            = "game-deluxegalaga.gif";
  389.  condition_a[3][item_offset+0]        = "..\\..\\Emulation\\shared\\adf\\games\\deluxegalaga.adf";
  390.  description_a[3][item_offset+0]     = lcl_txt_t4_deluxegalaga_descr;
  391.  action_type_a[3][item_offset+0]    = "execute";
  392.  action_file_a[3][item_offset+0]    = "WinUAE.exe";
  393.  action_params_a[3][item_offset+0]    = "-config=Configurations\\games\\deluxegalaga.uae";
  394.  action_dir_a[3][item_offset+0]        = "..\\..\\Emulation\\WinUAE";
  395.  
  396.  title_a[3][item_offset+1]            = lcl_txt_t4_hilt2_title;
  397.  image_a[3][item_offset+1]            = "game-hilt2.gif";
  398.  condition_a[3][item_offset+1]        = "..\\..\\Emulation\\shared\\adf\\games\\hilt2-1.adf";
  399.  description_a[3][item_offset+1]     = lcl_txt_t4_hilt2_descr;
  400.  action_type_a[3][item_offset+1]    = "execute";
  401.  action_file_a[3][item_offset+1]    = "WinUAE.exe";
  402.  action_params_a[3][item_offset+1]    = "-config=Configurations\\games\\hilt2.uae";
  403.  action_dir_a[3][item_offset+1]        = "..\\..\\Emulation\\WinUAE";
  404.  
  405.  title_a[3][item_offset+2]            = lcl_txt_t4_mindwalker_title;
  406.  image_a[3][item_offset+2]            = "game-mindwalker.gif";
  407.  condition_a[3][item_offset+2]        = "..\\..\\Emulation\\shared\\adf\\games\\mindwalker.adf";
  408.  description_a[3][item_offset+2]     = lcl_txt_t4_mindwalker_descr;
  409.  action_type_a[3][item_offset+2]    = "execute";
  410.  action_file_a[3][item_offset+2]    = "WinUAE.exe";
  411.  action_params_a[3][item_offset+2]    = "-config=Configurations\\games\\mindwalker.uae";
  412.  action_dir_a[3][item_offset+2]        = "..\\..\\Emulation\\WinUAE";
  413.  
  414.  title_a[3][item_offset+3]            = lcl_txt_t4_portsofcall_title;
  415.  image_a[3][item_offset+3]            = "game-portsofcall.gif";
  416.  condition_a[3][item_offset+3]        = "..\\..\\Emulation\\shared\\adf\\games\\portsofcall.adf";
  417.  description_a[3][item_offset+3]     = lcl_txt_t4_portsofcall_descr;
  418.  action_type_a[3][item_offset+3]    = "execute";
  419.  action_file_a[3][item_offset+3]    = "WinUAE.exe";
  420.  action_params_a[3][item_offset+3]    = "-config=Configurations\\games\\portsofcall.uae";
  421.  action_dir_a[3][item_offset+3]        = "..\\..\\Emulation\\WinUAE";
  422.  
  423.  title_a[3][item_offset+4]            = lcl_txt_t4_towerofsouls_title;
  424.  image_a[3][item_offset+4]            = "game-towerofsouls.gif";
  425. /* condition_a[3][item_offset+4]        = "..\\..\\Emulation\\shared\\hdf\\games\\af-games-01.hdf"; */
  426.  condition_a[3][item_offset+4]        = "..\\..\\Emulation\\shared\\adf\\games\\towerofsouls-1.adf";
  427.  description_a[3][item_offset+4]     = lcl_txt_t4_towerofsouls_descr;
  428.  action_type_a[3][item_offset+4]    = "execute";
  429.  action_file_a[3][item_offset+4]    = "WinUAE.exe";
  430.  action_params_a[3][item_offset+4]    = "-config=Configurations\\games\\towerofsouls.uae";
  431.  action_dir_a[3][item_offset+4]        = "..\\..\\Emulation\\WinUAE";
  432.  
  433.  title_a[3][item_offset+5]            = lcl_txt_t4_launcher_title;
  434.  image_a[3][item_offset+5]            = "screen-winuae.gif";
  435.  condition_a[3][item_offset+5]        = "..\\..\\Emulation\\WinUAE\\WinUAE.exe";
  436.  description_a[3][item_offset+5]     = lcl_txt_t4_launcher_descr;
  437.  action_type_a[3][item_offset+5]    = "execute";
  438.  action_file_a[3][item_offset+5]    = "WinUAE.exe";
  439.  action_params_a[3][item_offset+5]    = "-s use_gui=yes";
  440.  action_dir_a[3][item_offset+5]        = "..\\..\\Emulation\\WinUAE";
  441.  
  442.  title_a[3][item_offset+6]            = lcl_txt_t4_home_title;
  443.  image_a[3][item_offset+6]            = "screen-webbrowser.gif";
  444.  condition_a[3][item_offset+6]        = "";
  445.  description_a[3][item_offset+6]     = lcl_txt_t4_home_descr;
  446.  action_type_a[3][item_offset+6]    = "url";
  447.  action_file_a[3][item_offset+6]    = "http://www.amigaforever.com/games/";
  448.  action_params_a[3][item_offset+6]    = "";
  449.  action_dir_a[3][item_offset+6]        = "";
  450.  
  451.  items_a[3] = item_offset+7;
  452.  
  453.  for (i=0; i < max_tabs; i++) for (j=0; j < items_a[i]; j++)
  454.  {
  455.      if (condition_a[i][j] == "") featurepresent_a[i][j] = 1;
  456.     else featurepresent_a[i][j] = 0;
  457.  }
  458.  
  459.  /* now everything is initialized, in a worst case scenario it will consider features "not present", but at least it will work */
  460.  
  461.  /* the following takes a bit longer */
  462.  
  463.  for (i=0; i < max_tabs; i++)
  464.  {
  465.     /* let's enable features which require verification of file existence */
  466.     for (j=0; j < items_a[i]; j++)
  467.     {
  468.         if (featurepresent_a[i][j] == 0) if (menubox_exists(condition_a[i][j])) featurepresent_a[i][j] = 1;
  469.     }
  470.  
  471.     afm_tabs_initialized = i+1;
  472.  }
  473.  
  474.  /* feature detection is complete, let's use final "no feature" texts, if any */
  475.  txt_nofeature_current_general = txt_nofeature_general;
  476.  url_nofeature_current_general = url_nofeature_general;
  477.  
  478.  txt_nofeature_current_games = txt_nofeature_games;
  479.  url_nofeature_current_games = url_nofeature_games;
  480.  
  481.  af_tab_action(1);        /* let's display the content of the first tab (it did not like being rendered as part of onload) */
  482. }
  483.  
  484. /* build tab (1, 2, 3 or 4) */
  485. function af_tab_action(tab_position)        /* position is 1- */
  486. {
  487.  if (tab_position < 1 || tab_position > max_tabs) af_alert("Error: Incorrect tab argument.");
  488.  
  489.  if (tab_position <= afm_tabs_initialized)
  490.  {
  491.     if (afm_tab_changing_step > 0)
  492.     {
  493.         afm_tab_current = 0;    /* let's make sure nobody accesses whatever was in progress */
  494.         af_tab_out(0);
  495.         af_alert("Warning: Previous tab build did not complete (step "+afm_tab_changing_step+"). This could be caused by low system resources.");
  496.     }
  497.  
  498.     afm_tab_changing_step = 1;
  499.  
  500.     /* let's double-check in-tab items */
  501.     if (afm_item_current != 0)
  502.      {
  503.          af_item_out(afm_item_current);
  504.          af_alert("Warning: In-tab item still selected during change of tab.");
  505.      }
  506.  
  507.     afm_tab_changing_step = 2;
  508.  
  509.     /* tab visual status */
  510.     af_tab_gfx_select(tab_position);
  511.  
  512.     afm_tab_changing_step = 3;
  513.  
  514.     /* let's change the item texts (this is where debug tracing found a non-return condition on low system resources) */
  515.     for (i=0; i < items_a[tab_position-1]; i++)
  516.     {
  517.         document.all["item-"+(i+1)].innerHTML = title_a[tab_position-1][i];            /* arrays are 0-, active positions are 1- */
  518.     }
  519.  
  520.     afm_tab_changing_step = 4;
  521.  
  522.     /* let's clear any remaining item texts */
  523.     for (i = items_a[tab_position-1]; i < max_items; i++)
  524.     {
  525.         document.all["item-"+(i+1)].innerHTML = "";
  526.     }
  527.  
  528.     afm_tab_changing_step = 5;
  529.  
  530.     afm_tab_current = tab_position;
  531.     af_tab_out(tab_position);
  532.  
  533.     afm_tab_changing_step = 0;
  534.  }
  535.   else af_alert("Warning: Tab content not yet initialized (requested: "+tab_position+", initialized: "+afm_tabs_initialized+", previous step: "+afm_tab_changing_step+").");
  536. }
  537.  
  538. function af_tab_over(tab_position)            /* position is 1- */
  539. {
  540.  if (tab_position != afm_tab_gfx_current && tab_position != afm_tab_pointer_current && tab_position > 0)
  541.  {
  542.     if (afm_tab_pointer_current != 0) af_tab_out(afm_tab_pointer_current);
  543.     document.all["tab-"+tab_position].style.cursor = "hand";
  544.     afm_tab_pointer_current = tab_position;
  545.  }
  546. }
  547.  
  548. function af_tab_out(tab_position)            /* position is 1- (may be invoked with position 0 to clear whatever was left) */
  549. {
  550.  if (afm_tab_pointer_current != 0)
  551.  {
  552.     if (tab_position != afm_tab_pointer_current) af_tab_out(afm_tab_pointer_current);
  553.     if (tab_position > 0) document.all["tab-"+tab_position].style.cursor = "default";
  554.     afm_tab_pointer_current = 0;
  555.  }
  556. }
  557.  
  558. function af_tab_gfx_select(tab_position)    /* position is 1- */
  559. {
  560.  if (tab_position != afm_tab_gfx_current)
  561.  {
  562.     if (afm_tab_gfx_current != 0)
  563.         {
  564.             document.images["tab-"+afm_tab_current].src = "gfx/tabs/"+afm_tab_current+"_"+afm_language_display+".gif";
  565.             afm_tab_gfx_current = 0;
  566.         }
  567.  
  568.     document.images["tab-"+tab_position].src = "gfx/tabs/"+tab_position+"_"+afm_language_display+"-on.gif";
  569.     afm_tab_gfx_current = tab_position;
  570.  }
  571. }
  572.  
  573. function af_item_action(item_position)        /* position is 1- (here we don't care of visual status, we just do what we are told we have to do) */
  574. {
  575.  if (afm_tab_current != 0) if (item_position <= items_a[afm_tab_current-1])
  576.  {
  577.      if (!featurepresent_a[afm_tab_current-1][item_position-1])
  578.      {
  579.          if (afm_tab_current == afm_tab_type_games)
  580.              menubox_execute(url_nofeature_current_games);        /* the games tab may have a different unavailability text/action due to local rating regulations */
  581.          else
  582.              menubox_execute(url_nofeature_current_general);
  583.      }
  584.     else if (action_type_a[afm_tab_current-1][item_position-1] == "execute") menubox_execute(action_file_a[afm_tab_current-1][item_position-1],action_params_a[afm_tab_current-1][item_position-1],action_dir_a[afm_tab_current-1][item_position-1]);
  585.     else if (action_type_a[afm_tab_current-1][item_position-1] == "url") menubox_execute(action_file_a[afm_tab_current-1][item_position-1]);
  586.     else af_alert("Error: Incorrect action argument: "+item_position+" "+action_type_a[item_position-1]+".");
  587.  }
  588. }
  589.  
  590. function af_item_over(item_position)        /* position is 1- (note: system can call out without matching over, and viceversa) */
  591. {
  592.  afm_preview_description_pending = 0;        /* let's cancel pending second description text, if any */
  593.  
  594.  if (afm_tab_current != 0) if (item_position <= items_a[afm_tab_current-1] && afm_item_current != item_position)
  595.  {
  596.      if (afm_item_current != 0)
  597.      {
  598.          af_item_out(afm_item_current);
  599.          af_alert("Warning: Previous item still selected while entering new item.");
  600.      }
  601.  
  602.     if (image_a[afm_tab_current-1][item_position-1] != "") document.images["preview-1"].src = "gfx/preview/"+image_a[afm_tab_current-1][item_position-1];
  603.  
  604.     if (description_a[afm_tab_current-1][item_position-1] != "")
  605.     {
  606.         document.all["preview-description"].innerHTML = description_a[afm_tab_current-1][item_position-1];
  607.         if (!featurepresent_a[afm_tab_current-1][item_position-1] && !afm_preview_description_pending)
  608.         {
  609.             afm_preview_description_pending = 1;
  610.             setTimeout("af_item_nofeature();",750);
  611.         }
  612.     }
  613.  
  614.     afm_item_current = item_position;
  615.  }
  616. }
  617.  
  618. function af_item_out(item_position)        /* position is 1- (note: system can call out without matching over, and viceversa; system also calls out as part of onclick=action) */
  619. {
  620.  afm_preview_description_pending = 0;    /* let's cancel pending second description text, if any */
  621.  
  622.  if (afm_item_current != item_position && afm_item_current != 0) af_alert("Warning: Moving out of non-current item (old: "+afm_item_current+", new: "+item_position+").");
  623.  
  624.  if (afm_tab_current != 0) if (item_position <= items_a[afm_tab_current-1] && afm_item_current != 0)
  625.  {
  626.     document.images["preview-1"].src = "gfx/preview/blank.gif";
  627.     document.all["preview-description"].innerHTML = "";
  628.     afm_item_current = 0;
  629.  }
  630.  
  631.  /* note: since we don't use a formal semaphore it is in theory possible that rendering of the second description overlaps the above, causing a second text to persist */
  632. }
  633.  
  634. function af_item_nofeature()
  635. {
  636.  if (afm_preview_description_pending)
  637.  {
  638.          if (afm_tab_current == afm_tab_type_games)
  639.              document.all["preview-description"].innerHTML = "<i>"+txt_nofeature_current_games+"</i>";    /* the games tab may have a different unavailability text/action due to local rating regulations */
  640.          else
  641.              document.all["preview-description"].innerHTML = "<i>"+txt_nofeature_current_general+"</i>";
  642.  
  643.          afm_preview_description_pending = 0;
  644.  }
  645. }
  646.  
  647. function af_alert(message)
  648. {
  649.  if (afm_debug_messages) alert(message+" Kindly report this condition to support@cloanto.com.");
  650. }
  651.